Skip to contentSkip to conversation

How do I used Yocto to build an sdcard image for my Raspberry Pi 3 Model B?

DISCUSSION Thomas A. F. Thorne MEng AUS MIET 3 participants 6 messages Nov 3, 2016

lore
Share & tools
lore
#0 lore raw

I was starting to look at using Yocto <https://www.yoctoproject.org/> as a system for building software images for the Raspberry Pi 3 Model B that I have. I wanted to try using Yocto as there are some projects at my office that may begin using it in the future. One of the nice points is that all the setup of cross compilers for your target system is handled by a Yocto layer. There is already a Yocto layer for the Raspberry Pi
<http://git.yoctoproject.org/cgit/cgit.cgi/meta-raspberrypi/>(meta-raspberrypi
<http://git.yoctoproject.org/cgit/cgit.cgi/meta-raspberrypi/>) and a custom meta-rpi <https://github.com/jumpnow/meta-rpi> layer someone has put together with a few more example images.

I need to either cross-compile kernel modules or use Yocto as I have special drivers I wish to add to the Pi. These are already compiled and working on my Ubuntu PC and I hoped using Yocto might make it easy to cross compile these and any other updates in the future.

My difficulty is that the SD Card image talked about in
the meta-raspberrypi documentation
<http://git.yoctoproject.org/cgit/cgit.cgi/meta-raspberrypi/about/> and several tutorials, never gets generated, even on successful builds.

Tutorials Mentioning The Use Of |dd| & An .sdimg File

* Build a Raspberry Pi 2 Minimal Image with The Yocto Project

    <http://www.cnx-software.com/2015/02/27/yocto-project-raspberry-pi-2-board-minimal-image/>
  * Building Raspberry Pi Systems with Yocto
    <http://www.jumpnowtek.com/rpi/Raspberry-Pi-Systems-with-Yocto.html>
  * 12MB Minimal Image for Raspberry Pi using the Yocto Project
    <http://www.cnx-software.com/2013/07/05/12mb-minimal-image-for-raspberry-pi-using-the-yocto-project/>

* Poky Raspberry Pi SD Card Image
<http://www.crashcourse.ca/wiki/index.php/Poky_Raspberry_Pi_SD_Card_Image>

Commonly Seen Error

None of the builds I have made so far generate .sdimg files. When I try to add the |sdcard| or |sdcard_image-rpi| image types to IMAGE_FSTYPES I get messages such as:

|ERROR:
/home/thomasthorne/work/yocto-rpi/meta-raspberrypi/recipes-core/images/rpi-test-image.bb:
No IMAGE_CMD defined for IMAGE_FSTYPES entry 'sdcard_image-rpi' -
possibly invalid type name or missing support class |

Main Questions

/How do I generate the SD card image for my Pi from Yocto?/

Do I need to format the SD card manually and copy over the contents bit by bit?

Why do all these tutorials suggest it would be as simple as a single |dd| command? I guess something changed in the last couple of years and they are all out of date.

This was also posted at
http://raspberrypi.stackexchange.com/questions/57155/how-do-i-used-yocto-to-build-an-sdcard-image-for-my-raspberry-pi-3-model-b
before I realised it is probably more of a Yocto question than a Raspberry Pi one.

I will be very grateful of any help or advice you can offer. Even an explanation of when the generation of SD card images was dropped from the Yocto Project would be very helpful.

Regards,

Signature · 22 lines
Thomas A. F. Thorne MEng. AUS MIET
*Software Engineer*

*NET2EDGE*

Tel: +44 3450 130 030 <tel:+443450130030>
Email: [email protected] <mailto:[email protected]>
Web: http://www.Net2Edge.com/ <http://www.Net2Edge.com>

Net2Edge Limited is a company registered in England & Wales (Company No.
2438435, VAT No. GB 537553821) Passfield Oak, Liphook, Hampshire, GU30
7RL. This email transmission is confidential and intended solely for the
person or organisation to whom it is addressed. If you are not the
intended recipient, you must not copy, distribute or disseminate the
information, or take any action in reliance of it. Any views expressed
in this message are those of the individual sender, except where the
sender specifically states them to be the views of any organisation or
employer. If you have received this message in error, do not open any
attachment but please notify the sender (above) and delete this message
from your system. Please rely on your own virus check. Although all
outbound mail is checked for viruses, no responsibility is taken by the
sender for any damage rising out of any bug or virus infection.
#1 lore raw

Do you see an image with .rpi-sdimg in deploy/images/raspberrypi3

% ls *.rpi-sdimg
rpi-hwup-image-raspberrypi3-20161103050832.rootfs.rpi-sdimg rpi-hwup-image-raspberrypi3.rpi-sdimg@

Thats the one you should be able to dd

Quoted 48 lines · Thomas A. F. Thorne MEng AUS MIET

I was starting to look at using Yocto <https://www.yoctoproject.org/> as a system for building software images for the Raspberry Pi 3 Model B that I have. I wanted to try using Yocto as there are some projects at my office that may begin using it in the future. One of the nice points is that all the setup of cross compilers for your target system is handled by a Yocto layer. There is already a Yocto layer for the Raspberry Pi <http://git.yoctoproject.org/cgit/cgit.cgi/meta-raspberrypi/>(meta-raspberrypi <http://git.yoctoproject.org/cgit/cgit.cgi/meta-raspberrypi/>) and a custom meta-rpi <https://github.com/jumpnow/meta-rpi> layer someone has put together with a few more example images.

I need to either cross-compile kernel modules or use Yocto as I have special drivers I wish to add to the Pi. These are already compiled and working on my Ubuntu PC and I hoped using Yocto might make it easy to cross compile these and any other updates in the future.

My difficulty is that the SD Card image talked about in the meta-raspberrypi documentation <http://git.yoctoproject.org/cgit/cgit.cgi/meta-raspberrypi/about/> and several tutorials, never gets generated, even on successful builds.

Tutorials Mentioning The Use Of dd & An .sdimg File

Build a Raspberry Pi 2 Minimal Image with The Yocto Project <http://www.cnx-software.com/2015/02/27/yocto-project-raspberry-pi-2-board-minimal-image/>
Building Raspberry Pi Systems with Yocto <http://www.jumpnowtek.com/rpi/Raspberry-Pi-Systems-with-Yocto.html>
12MB Minimal Image for Raspberry Pi using the Yocto Project <http://www.cnx-software.com/2013/07/05/12mb-minimal-image-for-raspberry-pi-using-the-yocto-project/>
Poky Raspberry Pi SD Card Image <http://www.crashcourse.ca/wiki/index.php/Poky_Raspberry_Pi_SD_Card_Image>
Commonly Seen Error

None of the builds I have made so far generate .sdimg files. When I try to add the sdcard or sdcard_image-rpi image types to IMAGE_FSTYPES I get messages such as:

ERROR: /home/thomasthorne/work/yocto-rpi/meta-raspberrypi/recipes-core/images/rpi-test-image.bb: No IMAGE_CMD defined for IMAGE_FSTYPES entry 'sdcard_image-rpi' - possibly invalid type name or missing support class Main Questions

How do I generate the SD card image for my Pi from Yocto?

Do I need to format the SD card manually and copy over the contents bit by bit?

Why do all these tutorials suggest it would be as simple as a single dd command? I guess something changed in the last couple of years and they are all out of date.

This was also posted at http://raspberrypi.stackexchange.com/questions/57155/how-do-i-used-yocto-to-build-an-sdcard-image-for-my-raspberry-pi-3-model-b <http://raspberrypi.stackexchange.com/questions/57155/how-do-i-used-yocto-to-build-an-sdcard-image-for-my-raspberry-pi-3-model-b>before I realised it is probably more of a Yocto question than a Raspberry Pi one. I will be very grateful of any help or advice you can offer. Even an explanation of when the generation of SD card images was dropped from the Yocto Project would be very helpful.
Regards,
--
Thomas A. F. Thorne MEng. AUS MIET
Software Engineer

NET2EDGE

Tel: +44 3450 130 030 <tel:+443450130030>
Email: [email protected] <mailto:[email protected]>
Web: http://www.Net2Edge.com/ <http://www.net2edge.com/>

Net2Edge Limited is a company registered in England & Wales (Company No. 2438435, VAT No. GB 537553821) Passfield Oak, Liphook, Hampshire, GU30 7RL. This email transmission is confidential and intended solely for the person or organisation to whom it is addressed. If you are not the intended recipient, you must not copy, distribute or disseminate the information, or take any action in reliance of it. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of any organisation or employer. If you have received this message in error, do not open any attachment but please notify the sender (above) and delete this message from your system. Please rely on your own virus check. Although all outbound mail is checked for viruses, no responsibility is taken by the sender for any damage rising out of any bug or virus infection.

--
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto

#2 lore raw
Quoted 1 line

Do you see an image with .rpi-sdimg in deploy/images/raspberrypi3

No, files such as that not turning up is exactly what I am asking about.

thomasthorne@thorne-ul-dt:~/work/rpi-layer/build$ ls tmp/deploy/images/raspberrypi3/*.rpi-sdimg
ls: cannot access 'tmp/deploy/images/raspberrypi3/*.rpi-sdimg': No such file or directory
thomasthorne@thorne-ul-dt:~/work/rpi-layer/build$ ls tmp/deploy/images/raspberrypi2/*.rpi-sdimg
ls: cannot access 'tmp/deploy/images/raspberrypi2/*.rpi-sdimg': No such file or directory

I have tried building for Pi 2 and Pi 3. rpi-test-image, rpi-basic-image, console-image, core-image-minimal, core-image-full but none of them seem to have generated an SD image. Plenty of other files I could put together but no ready formed image to dd across.

Thomas A. F. Thorne<mailto:[email protected]> Software Engineer Net2Edge<http://www.net2edge.com/>

#3 lore raw
Quoted 14 lines · Thomas Thorne
Quoted 1 line

Do you see an image with .rpi-sdimg in deploy/images/raspberrypi3

No, files such as that not turning up is exactly what I am asking about.

thomasthorne@thorne-ul-dt:~/work/rpi-layer/build$ ls tmp/deploy/images/raspberrypi3/*.rpi-sdimg

ls: cannot access 'tmp/deploy/images/raspberrypi3/*.rpi-sdimg': No such file or directory

thomasthorne@thorne-ul-dt:~/work/rpi-layer/build$ ls tmp/deploy/images/raspberrypi2/*.rpi-sdimg
Quoted 7 lines

ls: cannot access 'tmp/deploy/images/raspberrypi2/*.rpi-sdimg': No such file or directory

I have tried building for Pi 2 and Pi 3. rpi-test-image, rpi-basic-image, console-image, core-image-minimal, core-image-full but none of them seem to have generated an SD image. Plenty of other files I could put together but no ready formed image to dd across.

What do you get from this?
% bitbake rpi-test-image -e | grep ^IMAGE_FSTYPES

If it doesn't say (at least)
IMAGE_FSTYPES="tar.bz2 ext3 rpi-sdimg"
then try making those settings in your local.conf

Signature · 4 lines
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------
#4 lore raw

May have solved the issue. Thank you for your help.

Quoted 2 lines

What do you get from this?
% bitbake rpi-test-image -e | grep ^IMAGE_FSTYPES

I get:

thomasthorne@thorne-ul-dt:~/work/rpi-layer/build$ bitbake rpi-test-image -e | grep ^IMAGE_FSTYPES
IMAGE_FSTYPES_DEBUGFS="tar.xz ext3"
IMAGE_FSTYPES="tar.xz ext3"

Presumably because I have in my local.conf:
IMAGE_FSTYPES = "tar.xz ext3"

If I update that to be "tar.xz ext3 sdimg" I get error messages such as:

$ bitbake rpi-test-image -e | grep ^IMAGE_FSTYPES
ERROR: /home/thomasthorne/work/yocto-rpi/meta-raspberrypi/recipes-core/images/rpi-test-image.bb: No IMAGE_CMD defined for IMAGE_FSTYPES entry 'sdimg' - possibly invalid type name or missing support class
ERROR: /home/thomasthorne/work/yocto-rpi/meta-raspberrypi/recipes-core/images/rpi-hwup-image.bb: No IMAGE_CMD defined for IMAGE_FSTYPES entry 'sdimg' - possibly invalid type name or missing support class
ERROR: /home/thomasthorne/work/yocto-rpi/meta-raspberrypi/recipes-core/images/rpi-basic-image.bb: No IMAGE_CMD defined for IMAGE_FSTYPES entry 'sdimg' - possibly invalid type name or missing support class
ERROR: /home/thomasthorne/work/rpi-layer/meta-rpi/images/qt5-basic-image.bb: No IMAGE_CMD defined for IMAGE_FSTYPES entry 'sdimg' - possibly invalid type name or missing support class
ERROR: /home/thomasthorne/work/rpi-layer/meta-rpi/images/console-image.bb: No IMAGE_CMD defined for IMAGE_FSTYPES entry 'sdimg' - possibly invalid type name or missing support class
ERROR: Failed to parse recipe: /home/thomasthorne/work/yocto-rpi/meta-raspberrypi/recipes-core/images/rpi-hwup-image.bb
ERROR: /home/thomasthorne/work/rpi-layer/meta-rpi/images/audio-image.bb: No IMAGE_CMD defined for IMAGE_FSTYPES entry 'sdimg' - possibly invalid type name or missing support class
ERROR: /home/thomasthorne/work/rpi-layer/meta-rpi/images/qt5-image.bb: No IMAGE_CMD defined for IMAGE_FSTYPES entry 'sdimg' - possibly invalid type name or missing support class
Quoted 3 lines

If it doesn't say (at least)
IMAGE_FSTYPES="tar.bz2 ext3 rpi-sdimg"
then try making those settings in your local.conf

That might help. I seem to now get:

$ bitbake rpi-test-image -e | grep ^IMAGE_FSTYPES
IMAGE_FSTYPES_DEBUGFS="tar.xz ext3 rpi-sdimg"
IMAGE_FSTYPES="tar.xz ext3 rpi-sdimg"

So the system is happy with the rpi-sdimg but not sdimg on its own.

Now when I perform $ bitbake rpi-test-image I get a few warnings about license files and then the baking seems to fail with an error about "dd: failed to open '/rpi-test-image-raspberrypi3-20161103111232.rootfs.rpi-sdimg': Permission denied". That is documented as do_image_rpi_sdimg failed with oe-core in krogoth branch https://github.com/agherzan/meta-raspberrypi/issues/30 for the meta-raspberrypi layer. That error is resolved on a krogoth specific branch for the meta-raspberrypi later. Checking out that branch instead of master allows the SD card image creation to succeed. I can now see sdimg files:

$ ls tmp/deploy/images/raspberrypi3/*.rpi-sdimg
tmp/deploy/images/raspberrypi3/rpi-test-image-raspberrypi3-20161103113408.rootfs.rpi-sdimg
tmp/deploy/images/raspberrypi3/rpi-test-image-raspberrypi3.rpi-sdimg

Once again thank you for your assistance.

If you use the Raspberry Pi StackExchange site, please add your suggestion of including rpi-sdimg as an answer to http://raspberrypi.stackexchange.com/questions/57155/how-do-i-used-yocto-to-build-an-sdcard-image-for-my-raspberry-pi-3-model-b If you do not use that site then I will add an answer with an attribution to you & this list later today.

Grateful Regards,

Thomas A. F. Thorne Software Engineer Net2Edge

#5 lore raw
Quoted 6 lines · Thomas Thorne

Presumably because I have in my local.conf:
IMAGE_FSTYPES = "tar.xz ext3"

yes thats the problem.